﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;

namespace DataEntities
{
    [Table(Name = "dbo.YuZuInfo")]
    public partial class YuZuInfo : Entity
    {
        private int _iYZDId;

        private int _iKeHuId;

        private int _iCarid;

        private double _dYuFuJE;

        private DateTime _tYZDate;

        private bool _bYZZF;

        private EntityRef<CarInfo> _CarInfo;

        private EntityRef<KeHuInfo> _KeHuInfo;

        public YuZuInfo()
        {
            this._CarInfo = default(EntityRef<CarInfo>);
            this._KeHuInfo = default(EntityRef<KeHuInfo>);
        }

        [Column(Storage = "_iYZDId", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public int iYZDId
        {
            get
            {
                return this._iYZDId;
            }
            set
            {
                if ((this._iYZDId != value))
                {
                    this.SendPropertyChanging("iYZDId");
                    this._iYZDId = value;
                    this.SendPropertyChanged("iYZDId",value);
                }
            }
        }

        [Column(Storage = "_iKeHuId", DbType = "Int")]
        public int iKeHuId
        {
            get
            {
                return this._iKeHuId;
            }
            set
            {
                if ((this._iKeHuId != value))
                {
                    if (this._KeHuInfo.HasLoadedOrAssignedValue)
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.SendPropertyChanging("iKeHuId");
                    this._iKeHuId = value;
                    this.SendPropertyChanged("iKeHuId",value);
                }
            }
        }

        [Column(Storage = "_iCarid", DbType = "Int")]
        public int iCarid
        {
            get
            {
                return this._iCarid;
            }
            set
            {
                if ((this._iCarid != value))
                {
                    if (this._CarInfo.HasLoadedOrAssignedValue)
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.SendPropertyChanging("iCarid");
                    this._iCarid = value;
                    this.SendPropertyChanged("iCarid",value);
                }
            }
        }

        [Column(Storage = "_dYuFuJE", DbType = "Float")]
        public double dYuFuJE
        {
            get
            {
                return this._dYuFuJE;
            }
            set
            {
                if ((this._dYuFuJE != value))
                {
                    this.SendPropertyChanging("dYuFuJE");
                    this._dYuFuJE = value;
                    this.SendPropertyChanged("dYuFuJE",value);
                }
            }
        }

        [Column(Storage = "_tYZDate", DbType = "DateTime")]
        public DateTime tYZDate
        {
            get
            {
                return this._tYZDate;
            }
            set
            {
                if ((this._tYZDate != value))
                {
                    this.SendPropertyChanging("tYZDate");
                    this._tYZDate = value;
                    this.SendPropertyChanged("tYZDate",value);
                }
            }
        }

        [Column(Storage = "_bYZZF", DbType = "Bit")]
        public bool bYZZF
        {
            get
            {
                return this._bYZZF;
            }
            set
            {
                if ((this._bYZZF != value))
                {
                    this.SendPropertyChanging("bYZZF");
                    this._bYZZF = value;
                    this.SendPropertyChanged("bYZZF",value);
                }
            }
        }

        [Association(Name = "CarInfo_YuZuInfo", Storage = "_CarInfo", ThisKey = "iCarid", OtherKey = "iCarid", IsForeignKey = true)]
        public CarInfo CarInfo
        {
            get
            {
                return this._CarInfo.Entity;
            }
            set
            {
                CarInfo previousValue = this._CarInfo.Entity;
                if (((previousValue != value)
                            || (this._CarInfo.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging("CarInfo");
                    if ((previousValue != null))
                    {
                        this._CarInfo.Entity = null;
                        previousValue.YuZuInfo.Remove(this);
                    }
                    this._CarInfo.Entity = value;
                    if ((value != null))
                    {
                        value.YuZuInfo.Add(this);
                        this._iCarid = value.iCarid;
                    }
                    else
                    {
                        this._iCarid = default(int);
                    }
                    this.SendPropertyChanged("CarInfo",value);
                }
            }
        }

        [Association(Name = "KeHuInfo_YuZuInfo", Storage = "_KeHuInfo", ThisKey = "iKeHuId", OtherKey = "iKeHuId", IsForeignKey = true)]
        public KeHuInfo KeHuInfo
        {
            get
            {
                return this._KeHuInfo.Entity;
            }
            set
            {
                KeHuInfo previousValue = this._KeHuInfo.Entity;
                if (((previousValue != value)
                            || (this._KeHuInfo.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging("KeHuInfo");
                    if ((previousValue != null))
                    {
                        this._KeHuInfo.Entity = null;
                        previousValue.YuZuInfo.Remove(this);
                    }
                    this._KeHuInfo.Entity = value;
                    if ((value != null))
                    {
                        value.YuZuInfo.Add(this);
                        this._iKeHuId = value.iKeHuId;
                    }
                    else
                    {
                        this._iKeHuId = default(int);
                    }
                    this.SendPropertyChanged("KeHuInfo",value);
                }
            }
        }
    }
}
